home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 25 / Cream of the Crop 25.iso / os2 / bbs102d.zip / bbsrecnt.cmd < prev    next >
OS/2 REXX Batch file  |  1997-02-11  |  21KB  |  719 lines

  1. /* Create an "index list" of files recently added to the bbs files area
  2. (during the last n days).  This index will contain the "url" to
  3. the file, the size and date, an optional description, and the required privileges.
  4. BBS can read, and display, these "index lists".
  5.  
  6. The following information is saved to the "stem" file (i.e. BBSRECNT.IDX):
  7.           .0 = # entries (N)
  8.           .!hdrfile = Optional header file
  9.           .!header = Generic header, used if hdrfile not specified
  10.           .!ftrfile = Optional footer file
  11.           .!title = Optional title
  12.           .!filedir = Root directory
  13.           .!days = oldest file parameter
  14.           .n = file name (relative to .!filedir).
  15.                Or, if =' ', then "it's a comment".
  16.           .n.!Ndate =normal date
  17.           .n.!time = 24hr time
  18.           .n.!size = size in bytes
  19.           .n.!jdate = julian date
  20.           .n.!privs= privileges required (* means "open access")
  21.           .n.!desc = description
  22. If you are ambitious, you can write your own routines. As long as they
  23. generate the above information, everything else is up to you. Note
  24. that you'll need to use the CVWRITE function to write the "stem" file.
  25.  
  26.  
  27.  
  28.                  **** IMPORTANT INSTALLATION NOTE ***
  29.  
  30.    A BBS.INI file MUST exist in the same directory BBS.CMD is installed to. 
  31.  
  32.  
  33.  */
  34.  
  35. /*A few User changeable non bbs.ini  parameters ... */
  36.  
  37. imagesize="width=24 height=24"   /* size of icons */
  38.  
  39.  
  40. verbose=1                       /* verbose=1  for verbose reporting */
  41.  
  42.  
  43. /*--------------   Load REXX libraries ----- */
  44. /* Load up advanced REXX functions */
  45. foo=rxfuncquery('sysloadfuncs')
  46. if foo=1 then do
  47.   call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
  48.   call SysLoadFuncs
  49. end
  50. foo=rxfuncquery('rexxlibregister')
  51. if foo=1 then do
  52.  call rxfuncadd 'rexxlibregister','rexxlib', 'rexxlibregister'
  53.  call rexxlibregister
  54. end
  55.  
  56.  
  57. /* some color stuff */
  58. ansion=checkansi()
  59. if ansion=1 then do
  60.   aesc='1B'x
  61.   cy_ye=aesc||'[37;46;m'
  62.   normal=aesc||'[0;m'
  63.   bold=aesc||'[1;m'
  64.   re_wh=aesc||'[31;47;m'
  65.   reverse=aesc||'[7;m'
  66. end
  67. else do
  68.   cy_ye="" ; normal="" ; bold="" ;re_wh="" ; 
  69.   reverse=""
  70. end  /* Do */
  71.  
  72. /* current directory is base directory */
  73. basedir=directory()
  74. basedir=strip(basedir,'t','\')||'\'
  75.  
  76. crlf='0d0a'x
  77.  
  78.  
  79. call load_rxl
  80.  
  81. inifile=basedir||'bbs.ini'
  82. isit=fileread(inifile,inilines,,'E')
  83. if isit<0 then do
  84.      say " ERROR: no BBS initialization file:" inifile
  85.      exit
  86. end  /* Do */
  87.  
  88. signal on syntax name bad1
  89. signal on error name bad1
  90. mm=0
  91.  
  92. gobot:
  93. mm=mm+1
  94. if mm > inilines.0 then signal good1
  95. aline=inilines.mm
  96. interpret aline
  97. signal gobot
  98.  
  99. bad1:
  100. signal off error ; signal off syntax ;
  101. say " ERROR: error in BBS initialization file: " aline
  102. exit
  103.  
  104. /* ------  bbs_ini okay, or skipped.  Check, various values, directories */
  105. /* this is a shortened version of what's in bbs.cmd */
  106. good1:
  107.  
  108. signal off error ; signal off syntax ;
  109. bbs_param=translate(bbs_param_dir,'\','/')
  110. if abbrev(strip(bbs_param,'l','\'),'\') =0 & pos(':',bbs_param)=0 then /* must be relative dir*/
  111.    bbsdir=basedir||bbs_param||'\'
  112. else
  113.    bbsdir=strip(bbs_param,'t','\')'\'
  114.  
  115. if dosisdir(strip(bbsdir,'t','\'))=0 then do
  116.      say " ERROR: no BBS parameters directory:" bbsdir
  117.     exit
  118. end
  119.  
  120. file_dir=strip(file_dir,'t','\')||'\'
  121.  
  122. ctlfile=stream(bbsdir||'BBS.CTL','c','query exists') /* blank means none */
  123. inctl=0
  124. if ctlfile<>' ' then inctl=get_ctlfile(ctlfile,verbose) /*returns ctls. global */
  125.  
  126. /* a time  date stamp */
  127.  d1=date('b')
  128.  t1=time('m')/(24*60)
  129.  nowtime=d1+t1
  130.  
  131. if symbol('USE_SERVERNAME')<>'VAR' then do
  132.    servername=get_hostname()
  133. end
  134. else do
  135.   if  use_servername="" | use_servername=0 then 
  136.       servername=get_hostname()
  137.   else
  138.      servername=use_servername
  139. end
  140.  
  141. say " "
  142.  
  143. /* ------- End of parameter initializations ------------ */
  144.  
  145.  
  146.  
  147. say "          " cy_ye " This is the BBS recent-files-index creator." normal
  148. say  " The recent-files-index is used to generate a list of recent uploads "
  149. say " "
  150. say " Note-- base directory is: "  bold basedir normal
  151. say "        parameters directory is: " bold bbsdir normal
  152. say "        access control file is: " bold ctlfile normal "(" inctl " entries )"
  153. SAY "        using servername: " bold  servername normal
  154.  
  155. gunky1:
  156. say " "
  157. call charout,  bold " Enter the directory  to find new files in (and under) " normal crlf
  158. call charout,"  ENTER= " file_dir  " ? "
  159. parse pull afile_dir
  160. if afile_dir="" then afile_dir=file_dir
  161. foo=dosisdir(strip(afile_dir,'t','\'))
  162. if foo=0 then do
  163.     say " Could not find directory: " afile_dir
  164.     signal gunky1
  165. end
  166. idxlist.!filedir=afile_dir
  167. say " "
  168.  
  169. boof:
  170. say " "
  171. call charout, reverse " Enter time span  (in days) of files to add to the index " normal crlf
  172. call charout,          '     (files older then this will not be included): '
  173. parse pull daysback
  174. if datatype(daysback)<>'NUM' | daysback="" then  signal boof
  175. idxlist.!days=daysback
  176.  
  177. getidx:
  178. say " "
  179. call charout, reverse " Enter name to use for the recent-files index " normal crlf
  180. call charout,          '  ENTER = BBSRECNT.IDX ? '
  181. parse pull idxfile
  182. if idxfile="" then idxfile="BBSRECNT.IDX"
  183. foos=stream(idxfile,'c','query exists')
  184. if foos<>' ' then
  185.    if yesno('     ' idxfile' exists. Overwrite? ')= 0 then signal getidx
  186.  
  187.  
  188. say " "
  189. sortbydate=yesno(" Sort by date (with most recent first)")
  190. dir_seps=0
  191. if sortbydate=0 then do
  192.    dir_seps=yesno("       ... include directory labels in the listing")
  193. end
  194. say " "
  195.  
  196. gethdr:
  197. foos="";aheader=""
  198. say " "
  199. call charout, reverse " Enter name of a header file (default is a generic header) " normal crlf
  200. call charout,          ' ? '
  201. parse pull  hdrfile
  202. if hdrfile<>" " then do
  203.    foos=stream(hdrfile,'c','query exists')
  204.    if foos=' ' then do
  205.       say " File does not exist " hdrfile ". Please re-enter "
  206.       signal gethdr
  207.   end  /* Do */
  208. end
  209. else do
  210.    say "You can modify the " reverse " generic " normal " header."
  211.    say "The header is currently (note the use of HTML elements): "
  212.    eek.1=' <body> <h2> Recent Files from: ' afile_dir '</h2>'
  213.    d2=date('n')
  214.    d1=date('b'); d1=d1-daysback ; d1=dateconv(d1,'b','n')
  215.    eek.2= "<em> Includes files created from " d1 "to" d2  " </em><br>"
  216.    say cy_ye "--> " normal eek.1
  217.    say cy_ye "--> " normal eek.2
  218.    say " You can modify or add to this header. Just hit " bold " ESC " normal " when done"
  219.    say  bold "   ... and be sure to start with a <BODY  > element! " normal
  220.    ili=0
  221.    do forever
  222.     ili=ili+1
  223.     cdo=' '
  224.     if ili<3 then cdo=eek.ili
  225.     call charout, cy_ye"  " normal
  226.     eek.ili=stringin(,6,cdo,74)
  227.     say " "
  228.     if eek.ili="" then leave
  229.    end /* do */
  230.    do mm=1 to ili
  231.       aheader=aheader||eek.mm||crlf
  232.    end /* do */
  233. end  /* Do */
  234. idxlist.!hdrfile=foos
  235. idxlist.!header=aheader
  236. say " "
  237.  
  238. getftr:
  239. foos=""
  240. say " "
  241. call charout, reverse " Enter name of a footer file (default is no footer) " normal crlf
  242. call charout,          ' ? '
  243. parse pull  ftrfile
  244. if ftrfile<>" " then do
  245.    foos=stream(ftrfile,'c','query exists')
  246.    if foos=' ' then do
  247.      say " File does not exist " ftrfile ". Please re-enter "
  248.      signal getftr
  249.    end  /* Do */
  250. end
  251. idxlist.!ftrfile=foos
  252. say " "
  253.  
  254. say " "
  255. call charout, reverse " Enter a title (it will be used in the <TITLE> ):  " normal crlf
  256. atitle="BBS: Latest files "
  257. call charout, cy_ye"  " normal
  258. atitle=stringin(,6,atitle,74)
  259. idxlist.!title=atitle
  260. say " "
  261.  
  262. say " "
  263.  
  264. foo=sysfiletree(afile_dir'*.*',gots,'FST')
  265. exlist=" " ; was_dir=" "
  266. isin=0 ; nexcluded=0
  267. notesgen.!did=0
  268.  
  269. snobal=0
  270. kfiles=0
  271. do mm=1 to gots.0
  272.    snobal=snobal+1
  273.    if (snobal)//101=100 then say " reading line " mm
  274.    parse var gots.mm tim siz . nam
  275.    parse var tim yr '/' mo '/' da '/' hr '/' min .
  276.    jdate=dateconv(yr'/'mo'/'da,'O','B')
  277.    if jdate+daysback < nowtime then iterate
  278.  
  279. /* if new directory, then get exclusion_file list and get description file */
  280.    gets=strip(filespec('d',nam)||filespec('p',nam),'t','\')
  281.    if was_dir <> gets then do
  282.         say " Examining files in: " gets
  283.         reldir='/'||translate(substr(gets,length(afile_dir)+2),'/','\')
  284.         was_dir=gets
  285.         exlist=get_exclusion(gets,verbose)
  286.         exlist=translate(exlist,'\','/')
  287.         oo=make_dsc_descriptions(gets,verbose)
  288.         if dir_seps=1 then do
  289.              isin=isin+1; 
  290.              idxlist.isin=' ';idxlist.isin.!desc='<u>'reldir'</u>'
  291.              idxlist.isin.!jdate=18888888
  292.         end  /* Do */
  293.         snobal=1
  294.    end
  295.  
  296.     nam0=filespec('n',nam)
  297. /* if matches exlist, then skip */
  298.     if is_excluded(nam0,exlist) then do
  299.       nexcluded=nexcluded+1
  300.       if verbose>0 then say "    :: Excluding: " nam0
  301.       iterate
  302.     end
  303.    isin=isin+1 ; kfiles=kfiles+1
  304.    idxlist.isin=translate(substr(nam,length(afile_dir)+2),'/','\')
  305.    idxlist.isin.!privs=fig_access(idxlist.isin)
  306.    idxlist.isin.!jdate=jdate
  307.    idxlist.isin.!size=siz
  308.    idxlist.isin.!ndate=dateconv(yr'/'mo'/'da,'O','N')
  309.    idxlist.isin.!time=hr':'min
  310.    idxlist.isin.!desc=find_description(nam0)
  311. /* information saved: .n = file name (relative to afile_dir
  312.                       .n.!Ndate =normal date
  313.                       .n.!time = 24hr time
  314.                       .n.!size = size in bytes
  315.                       .n.!jdate = julian date
  316.                       .n.!privs= privileges required
  317. */
  318. end /* do */
  319. idxlist.0=isin
  320.  
  321. say " # excluded files= " nexcluded
  322. say " # retained files = " kfiles
  323. say " # entries (including comments)= " isin
  324. /* now sort it ?*/
  325. if sortbydate=1 then do  /* by date */
  326.    booger.0=isin
  327.    do jj=1 to isin
  328.         booger.jj=left(idxlist.jj.!jdate,30) ','  idxlist.jj ',' ,
  329.                       idxlist.jj.!ndate  ',' idxlist.jj.!time  ',' ,
  330.                       idxlist.jj.!size  ',' idxlist.jj.!privs
  331.    end
  332.    foo=arraysort(booger,1,,1,30,'D','N')
  333.    do jj=1 to isin
  334.         parse var booger.jj idxlist.jj.!jdate ',' idxlist.jj ',' ,
  335.                       idxlist.jj.!ndate  ',' idxlist.jj.!time  ',' ,
  336.                       idxlist.jj.!size  ',' idxlist.jj.!privs
  337.         idxlist.jj=strip(idxlist.jj) 
  338.         idxlist.jj.!jdate=strip(idxlist.jj.!jdate)
  339.         idxlist.jj.!ndate=strip(idxlist.jj.!ndate)
  340.         idxlist.jj.!time=strip(idxlist.jj.!time)
  341.         idxlist.jj.!privs=strip(idxlist.jj.!privs)
  342.         idxlist.jj.!size=strip(idxlist.jj.!size)
  343.    end /* do */
  344. end  /* Do */
  345.  
  346. say " Number of entries saved to " idxfile " =  " isin
  347. foo=cvwrite(idxfile,idxlist)
  348. if aa=0 then say " Error: could not write " idxfile
  349.  
  350. exit
  351. /*********************************************************/
  352. /* Load srefilter macro libary, if no already loaded */
  353. load_rxl:procedure expose basedir
  354. nosref0=1
  355. signal on syntax name nosref
  356. filter_name=sref_version()   /* if not here, then skip to nosref */
  357. signal off syntax
  358.  
  359. return
  360. nosref:         /* if skipped here, then load .rxl */
  361. signal off syntax
  362. tt=basedir||'\SREFPRC1.RXL'
  363. aa=macroload(tt)
  364.  if aa=0 then do
  365.     say " ERROR: Could not load macrospace library: " tt
  366.    exit
  367. end
  368. RETURN 1
  369.  
  370.  
  371. /***********************/
  372. /* get the hostname (aa.bb.cc) for this machine */
  373. get_hostname: procedure
  374.     do queued(); pull .; end                   /* flush */
  375.     address cmd '@hostname'  '| rxqueue'    
  376.     parse pull hostname                        
  377.     return hostname
  378.  
  379.  
  380.   
  381.  /* ------------------------------------------------------------------ */
  382.  /* function: Check if ANSI is activated                               */
  383.  /*                                                                    */
  384.  /* call:     CheckAnsi                                                */
  385.  /*                                                                    */
  386.  /* where:    -                                                        */
  387.  /*                                                                    */
  388.  /* returns:  1 - ANSI support detected                                */
  389.  /*           0 - no ANSI support available                            */
  390.  /*          -1 - error detecting ansi                                 */
  391.  /*                                                                    */
  392.  /* note:     Tested with the German and the US version of OS/2 3.0    */
  393.  /*                                                                    */
  394.  /*                                                                    */
  395.  CheckAnsi: PROCEDURE
  396.    thisRC = -1
  397.  
  398.    trace off
  399.                          /* install a local error handler              */
  400.    SIGNAL ON ERROR Name InitAnsiEnd
  401.  
  402.    "@ANSI 2>NUL | rxqueue 2>NUL"
  403.  
  404.    thisRC = 0
  405.  
  406.    do while queued() <> 0
  407.      queueLine = lineIN( "QUEUE:" )
  408.      if pos( " on.", queueLine ) <> 0 | ,                       /* USA */
  409.         pos( " (ON).", queueLine ) <> 0 then                    /* GER */
  410.        thisRC = 1
  411.    end /* do while queued() <> 0 */
  412.  
  413.  InitAnsiEnd:
  414.  signal off error
  415.  RETURN thisRC
  416.  
  417. /* -------------------- */
  418. /* get a yes or no , return 1 if yes */
  419. yesno:procedure expose normal reverse bold
  420. parse arg fooa , allopt,altans
  421. if altans<>" " & words(altans)>1 then do
  422.    w1=strip(word(altans,1))
  423.    w2=strip(word(altans,2))
  424.    a1=left(w1,1) ; a2=left(w2,1)
  425.    a1a=substr(w1,2) ; a2a=substr(w2,2)
  426. end
  427. else do
  428.     a1='Y' ; a1a='es'
  429.     a2='N' ; a2a='o'
  430. end  /* Do */
  431. ayn='  '||bold||a1||normal||a1a||'\'||bold||a2||normal||a2a
  432. if allopt=1 then  ayn=ayn||'\'||bold||'A'||normal||'ll'
  433.  
  434. do forever
  435.  foo1=normal||reverse||fooa||normal||ayn
  436.  call charout,  foo1 normal ':'
  437.  pull anans
  438.  if abbrev(anans,a1)=1 then return 1
  439.  if abbrev(anans,a2)=1 then return 0
  440.  if allopt=1 & abbrev(anans,'A')=1 then return 2
  441. end
  442.  
  443.  
  444.  
  445.  
  446. /* ----------------------------------- */
  447. /* match a file with the control access files (ctls.), and extract neededp privs
  448.  If no match, return emtpy string */
  449. fig_access:procedure expose ctls.
  450.  
  451. parse upper arg theurl0
  452.  nnn=lastpos('/',theurl0)
  453.  if nnn=0 then
  454.     theurl='/'
  455.  else
  456.      theurl=left(theurl0,nnn)
  457.  gotit=0
  458.  starat=0 ;  afterstar=0 ;useprivs=' '
  459.  do mm=1 to ctls.0
  460.     aurl=ctls.mm
  461.     ares=sref_wildcard(theurl,aurl||' '||aurl,0)
  462.     parse var ares astat "," aurl2 ;  astat=strip(astat)
  463.     if astat=0 then iterate   /* no match */
  464.     if astat=1 then do
  465.         gotit=mm
  466.         leave
  467.     end
  468.     else  do
  469.        t1=pos('*',aurl)
  470.        t33=length(aurl)-t1
  471.        if t1 >= starat  then do
  472.           if t1 > starat | t33>afterstar then do
  473.              starat=t1 ; afterstar=t33
  474.              gotit=mm 
  475.           end
  476.        end
  477.     end
  478.  end
  479.  if gotit>0  then useprivs=ctls.gotit.!Privs
  480.  return useprivs
  481.  
  482.  
  483. /***********************************************************/
  484. /* check for, and read, the access control file */
  485. get_ctlfile:procedure expose ctls.
  486. parse arg ctlfile,verbose
  487.  
  488. aa=fileread(ctlfile,tmps,,'E')
  489. if aa=0 then return 0
  490.  
  491. /*if verbose>0 then say "  .... using control file: " ctlfile*/
  492.  
  493. inctl=0
  494. do mm=1 to tmps.0
  495.     aline=strip(tmps.mm)
  496.     if aline='' | abbrev(aline,';')=1  then iterate
  497.     parse upper var aline aurl aprivs ',' .
  498.     aurl=translate(aurl,'/','\')
  499.     aurl=strip(aurl,,'/')
  500.     if pos('*',aurl)=0 then aurl=aurl||'/'
  501.     inctl=inctl+1
  502.     ctls.inctl=strip(aurl)
  503.     ctls.inctl.!privs=aprivs
  504. end /* do */
  505. ctls.0=inctl
  506. return inctl
  507.  
  508.  
  509.  
  510. /***************/
  511. @ get list of exclusions. Use own directory version if available,
  512. or bbs_param_dir if not (they are NOT cumulative)*/
  513. get_exclusion:procedure expose bbsdir exclusion_file
  514. parse arg gets,verbose
  515. arf=strip(gets||'\'||exclusion_file)
  516. t1=stream(arf,'c','query exists')
  517. if t1=' ' then
  518.     t1=stream(bbsdir||exclusion_file,'c','query exists')
  519.  
  520. if t1=' ' then
  521.    return ' '
  522. oo=linein(t1,1,0)
  523. exlist=""
  524. if verbose=1 then say "    ... Using exclusion list: " t1
  525. /* else, read the list */
  526. do while lines(t1)=1
  527.    oo=strip(linein(t1))
  528.    if abbrev(oo,';')=1 then iterate
  529.    exlist=exlist||' '||oo
  530. end /* do */
  531. tt=translate(exlist,' ',','||'1a090a0d'x)
  532. return tt
  533.  
  534.  
  535.  
  536. /*****************************//
  537. /* get file descriptions from .dsc files (does NOT do auto descriptions) */
  538. make_dsc_descriptions:procedure expose continuation_flag default_description ,
  539.          NOTES. bbsdir description_file arglist. notesgen. wildnotes.
  540. parse arg gets,verbose
  541. notes1.0=0
  542. notes.0=0
  543. if description_file<>' ' then do
  544.   yuba=strip(gets||'\'||description_file)
  545.   t1=stream(yuba,'c','query exists')
  546.   if t1<>' ' then do
  547.      if verbose>0  then say  "    ... using description file: " t1
  548.      eek=fileread(t1,'notes',,'E')
  549.      ekk=fix_notes(continuation_flag)
  550.   end
  551. end
  552.  
  553. /* copy to a temporary array, and do it again below */
  554. do arf=1 to notes.0
  555.    notes1.arf.dastuff=notes.arf.dastuff
  556.    notes1.arf.daname=translate(notes.arf.daname,'/','\')
  557. end /* do */
  558. notes1.0=notes.0
  559.  
  560. notes.0=0               /* get next set */
  561.  
  562.  
  563. /* get a generic description file? */
  564. if notesgen.!did=0 & description_file<>' ' then do
  565.   yipper=strip(bbsdir||description_File)
  566.   if verbose=1 then say " Storing generic descriptions: " yipper
  567.   t1=stream(yipper,'c','query exists')
  568.   if t1<>' ' then do
  569.      eek=fileread(t1,'notes',,'E')
  570.      ekk=fix_notes(continuation_flag)
  571.   end
  572.   do jk=1 to notes.0
  573.      notesgen.jk.daname=notes.jk.daname
  574.      notesgen.jk.dastuff=translate(notes.jk.dastuff,'/','\')
  575.   end /* do */
  576.   notesgen.0=notes.0
  577.   notesgen.!did=1
  578.   if verbose>0 then say "  .... # of generic descriptions= " notesgen.0
  579. end
  580. /* add this set to notes1 */
  581. if notesgen.0>0 then do
  582.   obie=notes1.0
  583.   do mm=1 to notesGEN.0
  584.     obie2=obie+mm
  585.     notes1.obie2.daname=translate(notesgen.mm.daname,'/','\')
  586.     notes1.obie2.dastuff=notesgen.mm.dastuff
  587.   end
  588.   notes1.0=obie2
  589. end
  590. drop notes.     /* copy to notes. */
  591. do pp=1 to notes1.0
  592.   notes.pp.daname=notes1.pp.daname
  593.   notes.pp.dastuff=notes1.pp.dastuff
  594.   notes.pp=notes1.pp.daname  /* used for searching */
  595. end /* do */
  596. notes.0=notes1.0
  597. drop notes1.
  598. if default_description<>' ' then do
  599.    ii=notes.0+1
  600.    notes.ii=default_description
  601.    notes.ii.daname='*'
  602.    notes.ii.dastuff=default_description
  603.    notes.0=ii
  604. end  /* Do */
  605.  
  606. /* create the "wildcarded" notes list (used in find_description)*/
  607. nwilds=0
  608. do mm=1 to notes.0
  609.    if pos('*',notes.mm.daname)>0 then do
  610.        nwilds=nwilds+1
  611.        wildnotes.nwilds.daname=notes.mm.daname
  612.        wildnotes.nwilds.dastuff=notes.mm.dastuff
  613.    end  /* Do */
  614. end /* do */
  615. wildnotes.0=nwilds
  616. return 0
  617.  
  618.  
  619.  
  620. return 0
  621.  
  622.  
  623. /**********/
  624. @ fix up notes. info */
  625. fix_notes:procedure expose notes. arglist.
  626. parse arg daflag
  627. if notes.0=0 | arglist.!nodesc=1 then return 0
  628. isnew=1
  629. crlf='0d0a'x
  630.  
  631. stripme=0
  632. if left(daflag,1)=' ' & left(daflag,2)<>' ' then do
  633.    stripme=1
  634.    daflag=strip(daflag)
  635. end
  636. tmps.1=notes.1
  637. tmps.1.!nlines=1
  638. do mm=2 to notes.0
  639.    iscont=0
  640.    if stripme=0 then do   /* not a ' x' continution flag, so must be exact match */
  641.       iscont=abbrev(notes.mm,daflag)
  642.    end
  643.    else do              /* strip spaces from 2..n, then match the "stripped" flag*/
  644.       if left(notes.mm,1)=' ' then   /* if not first space, not a match */
  645.          iscont=abbrev(strip(notes.mm),daflag)
  646.    end
  647.    if iscont=0 then do     /* not a continuation line */
  648.         isnew=isnew+1
  649.         tmps.isnew.!nlines=1
  650.         tmps.isnew=notes.mm
  651.     end
  652.     else do
  653.         milk=pos(daflag,notes.mm)
  654.         tmps.isnew=tmps.isnew||crlf||substr(notes.mm,milk+length(daflag))
  655.         tmps.isnew.!nlines=tmps.isnew.!nlines+1
  656.     end
  657. end
  658. do mm=1 to isnew        /* pull out filename and it's comment */
  659.     parse var tmps.mm  notes.mm.DANAME  notes.mm.daSTUFF
  660.     notes.mm.DANAME=upper(notes.mm.daname)
  661.     notes.mm.!nlines=tmps.mm.!nlines
  662. end
  663.  
  664.  
  665. notes.0=isnew
  666.  
  667. return 0
  668.  
  669.  
  670. /*****************/
  671. /* if aname (or wildcard match) is in exnames, then return 1 */
  672. is_excluded:procedure
  673. parse upper arg aname, exnames
  674. if exnames=' ' then return 0
  675.  
  676. aname=translate(aname,'\','/')
  677. /* check exacts */
  678.   if  wordpos(aname,exnames)>0 then return 1
  679. /* check for wildcards */
  680. if pos('*',exnames)=0 then return 0
  681.  
  682. /* got some, check them */
  683. do mm=1 to words(exnames)
  684.    bword=word(exnames,mm)
  685.    if pos('*',bword)=0 then iterate
  686.    ares=sref_wildcard(aname,bword||' '||bword,0)
  687.    parse var ares astat "," . ; astat=strip(astat)
  688.    if astat<>0 then  return 1
  689. end
  690. return 0
  691.  
  692.  
  693.  
  694.  
  695. /******************/
  696. /* find a description --  .dsc files */
  697. find_description:procedure expose notes. wildnotes. 
  698.  
  699. parse arg chkme
  700.  
  701. if notes.0=0 then return ' '
  702. tt=arraysearch(notes.,yikes,chkme,'X')
  703. if tt>0 then do
  704.        poop=yikes.1
  705.        return notes.poop.dastuff
  706.  end  /* Do */
  707.  
  708. /* else, try wildcard match */
  709.  do ini=1 to wildnotes.0
  710.        oo=sref_wildcard(chkme,wildnotes.ini.daname,0)
  711.        parse var oo stat ',' . ; stat=strip(stat)
  712.        if stat<>0 then return wildnotes.ini.dastuff
  713.  end
  714.  
  715.  return ' '
  716.  
  717.  
  718.  
  719.